#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define MSG_NUM 3
#define MSG_SIZE 20

void RefreshString(char *, char *);

int main()
{
    char *message[MSG_NUM];
    for (int i = 0; i < MSG_NUM; i++) {
        message[i] = (char *)malloc(MSG_SIZE * sizeof(char));
        scanf(" %s", message[i]);
    }

    for (int i = 0; i < MSG_NUM; i++)
        for (int j = 0; j < MSG_NUM - i - 1; j++)
            if (strcmp(message[j], message[j + 1]) >= 0) 
                RefreshString(message[j], message[j + 1]);

    for (int i = 0; i < MSG_NUM; i++) 
        printf("%s\n", message[i]);

    return 0;
}

void RefreshString(char *a, char *b)
{
    char temp[MSG_SIZE];
    strcpy(temp, a);
    strcpy(a, b);
    strcpy(b, temp);
}
